﻿using StoryTeller.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StoryTeller.Infrastructure.DataAccess.Parser
{
    public static class UserParser
    {
        public static User ParseEntityToDomain(this EUser entity)
        {
            User usr = new User();

            usr.CreationDate = entity.CreationDate;
            usr.Id = entity.Id;
            usr.LastLogin = entity.LastLogin.Value;
            usr.LastUpdate = entity.LastUpdate.Value;
            usr.Name = entity.Name;
            usr.UserIdentity = entity.UserIdentity;
            usr.Provider = entity.Provider;
            usr.ImageUrl = entity.ImageUrl;

            return usr;
        }

        public static EUser ParseDomainToEntity(this User domain)
        {
            EUser eusr = new EUser();

            eusr.CreationDate = domain.CreationDate;
            eusr.Id = domain.Id;
            eusr.LastLogin = domain.LastLogin;
            eusr.LastUpdate = domain.LastUpdate;
            eusr.Name = domain.Name;
            eusr.UserIdentity = domain.UserIdentity;
            eusr.ImageUrl = domain.ImageUrl;
            eusr.Provider = domain.Provider;

            return eusr;
        }
    }
}
